package me.jessyan.mvparms.demo.mvp.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.jess.arms.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

import me.jessyan.mvparms.demo.mvp.ui.fragment.OneLevelBaseFragment;

/**
 * @author DrChen
 * @Date 2019/2/25 0025.
 * qq:1414355045
 */
public class HomeViewPagerAdapter extends FragmentPagerAdapter {
    List<OneLevelBaseFragment> fragments;

    public HomeViewPagerAdapter(FragmentManager fm, List<OneLevelBaseFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    public List<OneLevelBaseFragment> getFragments() {
        if (fragments == null) {
            return new ArrayList<>();
        }
        return fragments;
    }



    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
